package tools

import (
	"math/rand"
	"strconv"
	"time"
)

func StringToFloat64(n string) float64 {
	d, _ := strconv.ParseFloat(n, 64)
	return d
}

func StringToInt64(n string) int64 {
	d, _ := strconv.ParseInt(n, 10, 64)
	return d
}

/**
获取随机字符串
*/
func GetUuidRandomString(l int) string {
	str := "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	bytes := []byte(str)
	result := make([]byte, 0)
	r := rand.New(rand.NewSource(time.Now().UnixNano()))
	for i := 0; i < l; i++ {
		result = append(result, bytes[r.Intn(len(bytes))])
	}
	return string(result)
}
